﻿using Jsdl.Domain.Type;
using Newtonsoft.Json;

namespace Jsdl.Domain.Intermediate
{
    public class JsdlProperty : JsdlType
    {
        /// <summary>Gets or sets the formatting of the property. </summary>
        [JsonProperty(PropertyName = "format")]
        public string Format { get; set; }

        /// <summary>Gets or sets a value indicating whether the property is required. </summary>
        [JsonIgnore]
        public virtual bool Required // default = false
        {
            get { return RequiredRaw.HasValue && RequiredRaw.Value; }
        }

        [JsonProperty(PropertyName = "required")]
        public bool? RequiredRaw { get; set; }
    }
}